package com.yang.smsgateway.enums;

import lombok.Getter;

@Getter
public enum CMPP2ResultEnums {
    OK(0,"正确"),
    MESSAGE_STRUCTURE_ERROR(1,"消息结构错"),
    COMMAND_WORD_ERROR(2,"命令字错"),
    MESSAGE_ID_ERROR(3,"消息序号重复"),
    MESSAGE_LEN_ERROR(4,"消息长度错"),
    TARIFF_CODE_ERROR(5,"资费代码错"),
    MAX_MESSAGE_ERROR(6,"超过最大信息长"),
    BUSINESS_CODE_ERROR(7,"业务代码错"),
    FLOW_CONTROL_ERROR(8,"流量控制错"),
    OTHER_ERROR(9,"其他错误"),
    ;

    private int result;
    private String msg;

    CMPP2ResultEnums(int result, String msg) {
        this.result = result;
        this.msg = msg;
    }

    public static String getMsg(int result){
        String msg = "其他错误";
        for (CMPP2ResultEnums e : values()) {
            if (e.getResult() == result){
                msg = e.msg;
            }
        }
        return msg;
    }
}
